package day07;

//本类是用来测试封装的演示demo
public class Test02 {
    public static void main(String[] args) {
        Student s1 = new Student();
        s1.eat();
        s1.sid = 1;
        s1.setName("张三");

        System.out.println(s1.getName());

    }
}

class Student {
    int sid;
     private String name;//private权限修饰私有化---属性私有化
    private String subject;//private权限修饰私有化---属性私有化

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void study() {//紫色为局部变量
        System.out.println("好好学习，天天向上");
    }

    public void sleep() {
        System.out.println("好好睡觉，不要熬夜");
    }

    public void eat() {
        System.out.println("吃吃吃，吃饱饱");
    }
}